-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PP-337 Quicksight dashboard embed URL generation #1378
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1378 +/- ##
==========================================
+ Coverage 90.29% 90.31% +0.01%
==========================================
Files 232 234 +2
Lines 29751 29841 +90
Branches 6797 6820 +23
==========================================
+ Hits 26864 26950 +86
- Misses 1843 1847 +4
Partials 1044 1044
☔ View full report in Codecov by Sentry. |
v = f(*args, **kwargs) | ||
try: | ||
v = f(*args, **kwargs) | ||
except ProblemError as ex: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this in so we can globally manage raising ProblemErrors
This one looks okay to me, but I'd like @dbernstein to take a look since hes done the rest of the quicksight work. |
README.md
Outdated
##### Quicksight Dashboards | ||
|
||
For generating quicksight dashboard links the following environment variable is required | ||
`QUICKSIGHT_AUTHORIZED_ARNS` - A comma separated list of `arn:aws:quicksight:...` format ARN strings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we'll likely have multiple dashboards that can be displayed within the CM, I think we'll need to pass in a dictionary where the keys are logical dashboard names such as "library" or "consortium" or "all_libraries" and the values are ARNs that link to environment specifi dashboards. To decouple the logical name from the dashboard id, I suggest we use the logical name (ie the key) in the Circulation manager API calls below. Those logical names will then be hardcoded in the Admin UI. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed this to a Dict format like:
{ "name": [<arn list>]}
This should be json dumped from ansible into the same env var.
I also added an /admin/quicksight_embed/names
API so the dashboard names are not hard coded anywhere (frontend or backend).
This brings up an issue with authorisation though, all dashboard names will be visible to all dashboard users regardless of whether there is any intersecting library between their authorisation and the dashboards available libraries.
In which case the admin API will throw authorisation errors when trying to create an URL without any libraries visible to the user.
While not a security concern, it just becomes a game of guessing which dashboards are available for the user themselves.
@@ -50,6 +50,10 @@ class Configuration(ConfigurationConstants): | |||
OD_FULFILLMENT_CLIENT_KEY_SUFFIX = "OVERDRIVE_FULFILLMENT_CLIENT_KEY" | |||
OD_FULFILLMENT_CLIENT_SECRET_SUFFIX = "OVERDRIVE_FULFILLMENT_CLIENT_SECRET" | |||
|
|||
# Quicksight | |||
# Comma separated aws arns | |||
QUICKSIGHT_AUTHORIZED_ARNS_KEY = "QUICKSIGHT_AUTHORIZED_ARNS" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above re dictionary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As usual, excellent work @RishiDiwanTT . See my suggestion re use of a dictionary. I'm curious what your thoughts are on that.
api/admin/routes.py
Outdated
@@ -340,6 +348,18 @@ def stats(): | |||
return statistics_response.api_dict() | |||
|
|||
|
|||
@app.route("/admin/quicksight_embed/<dashboard_id>") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we'll want to use the logical name here instead of the dashboard id. That way the Admin UI can use hard-coded logical names which can be completely decoupled from the dashboard ARN. (Per my comments above on the README).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @RishiDiwanTT : 🚀
Depends on a comma separated string of dashboard ARNs under QUICKSIGHT_AUTHORIZED_ARNS environment variable
…nerics Re-implemented as a functional_validator
Added the a /names API to get the dashboard names available
8371069
to
4b562bd
Compare
Description
Depends on a comma separated string of dashboard ARNs under
QUICKSIGHT_AUTHORIZED_ARNS
environment variable.Exposes the URL
/admin/quicksight_embed/<dashboard-id>?libraryIds=1,2,3
and returnsdict(embedUrl=....)
.Currently allows access till the
LIBRARIAN
admin role.Motivation and Context
Certain library Admin users need on-the-go and anonymous access to the quicksight dashboards for analytics.
JIRA
How Has This Been Tested?
Manually tested the link generation with the tpp-dev account.
New unit tests were written.
Checklist